/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights
 * reserved. <a>http://www.cqcis.com</a>
 */
package com.cq.bd.dto;

import com.cq.bd.security.UserDetails;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * 登陆结果
 * 
 * @author huangmy
 * @date 2009-10-2
 */
public class LoginResult {
    public final static int STATE_LOGIN_SUCCESS = 1; // 状态 登陆成功
    public final static int STATE_LOGIN_FAILURE = 2; // 状态 登陆失败
    public final static String MESSGE_USER_NOT_EXIST = "用户不存在"; // 用户不存在

    private int state; // 登陆状态
    private String message; // 登陆消息
    private UserDetails userDetails; // 用户详情

    public LoginResult(int state, String message) {
        this.state = state;
        this.message = message;
    }
    
    public LoginResult(int state, String message, UserDetails userDetails) {
        this.state = state;
        this.message = message;
        this.userDetails = userDetails;
    }
    
    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this).append("state", this.state).append("message", this.message).append(
                "userDetails", this.userDetails).toString();
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public UserDetails getUserDetails() {
        return userDetails;
    }

    public void setUserDetails(UserDetails userDetails) {
        this.userDetails = userDetails;
    }
}
